<!-- 数据列表 -->

<template>
  <div class="list">
    <VuePerfectScrollbar class="edit-scroll-area" v-if="display">
      <div
        class="content"
        v-for="(item, index) in dataList"
        :key="index"
        @click="details(item)"
      >
        <div class="box_left">
          <!-- <div class="left_top">
            <img src="../../../assets/images/icon/location_icon.png" alt />
            <span class="icon_font">{{index + 1}}</span>
            <span class="font-title">{{item.name}}</span>
          </div>
          <div class="left_bottom">
            <span class="title_icon_one">{{item.municipalityName}}</span>
            <span class="title_icon_two">{{item.length}}</span>
          </div> -->
          <span class="font-title">{{ item.name }}</span>
          <div class="list-info">
            <span class="title_icon_one">{{ item.municipalityName }}</span>
            <span class="title_icon_two">{{ item.length }}</span>
          </div>
        </div>
        <div class="box_right">
          <img :src="baseUrl + item.realisticPictureList[0].path" alt />
        </div>
      </div>
    </VuePerfectScrollbar>
    <!-- 数据详情组件 -->

    <VuePerfectScrollbar class="edit-scroll-area" v-else>
      <infoDetails :selectData="selectData" @details="details"></infoDetails>
    </VuePerfectScrollbar>
  </div>
</template>

<script>
import VuePerfectScrollbar from "vue-perfect-scrollbar"; //滚动条
import infoDetails from "./infoDetails";
import base from "@/api/base";

export default {
  props: {
    dataList: {}
  },
  data() {
    return {
      baseUrl: base.DOWNLOADURL,
      display: true,
      selectData: ""
    };
  },
  components: {
    VuePerfectScrollbar,
    infoDetails
  },
  mounted() {},
  methods: {
    details(item) {
      this.display = !this.display;
      this.selectData = item;
      this.$emit("setCenter", item.lng, item.lat,this.selectData.id);
    },
    detailsShow(item) {
      this.display = true
    },
  }
};
</script>

<style lang="scss" scoped>
.edit-scroll-area {
  position: relative;
  margin: auto;
  max-height: 84vh;
  //   height: calc(100% - 100px);
  width: 100%;
  padding-bottom: 10px;
}

.content {
  width: 280px;
  height: 90px;
  //   background: pink;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
  .box_left {
    margin-left: 10px;
    width: 150px;
    height: 78px;
    background: url("../../../assets/images/homeMap/list-line.png") no-repeat
      center;
    background-size: 100%;

    .font-title {
      font-weight: 600;
      font-size: 15px;
      font-weight: bold;
      color: #a1cafd;
      background: linear-gradient(0deg, #78a8b7 0%, #ffffff 80.8349609375%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      display: inline-block;
      margin-top: 5px;
    }
    .left_top {
      width: 200px;
      display: flex;
      align-items: center;
      img {
        width: 40px;
      }
      .icon_font {
        position: absolute;
        left: 10px;
        color: white;
        font-size: 12px;
        display: inline-block;
        width: 40px;
        text-align: center;
      }
    }
    .list-info {
      margin-left: 9px;
      color: #e0e1e1;
      line-height: 30px;
      position: relative;
      left: 45px;
      top: -20px;
      .title_icon_one {
        min-width: 56px;
        width: auto;
        height: 21px;
        font-size: 12px;
        display: inline-block;
        text-align: center;
        // line-height: 21px;
        margin-right: 5px;
        border-radius: 20px;
        padding: 0 5px;
        display: block;
      }
      .title_icon_two {
        min-width: 56px;
        width: auto;
        // height: 21px;
        font-size: 12px;
        display: inline-block;
        text-align: center;
        border-radius: 20px;
        padding: 0 5px;
        display: block;
      }
    }
  }
  .box_right {
    width: 110px;
    height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
    img {
      width: 100%;
      height: 90%;
      border-radius: 5px;
    }
  }
}
.list {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0);
  z-index: 9999 !important;
}
</style>
